﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WOS.Common
{
    [Flags]
    public enum ProviderFlag
    {
        None = 0,
        Resumable = 1
    }
    public sealed class ProviderInfo
    {
        public readonly static Guid Megaupload = new Guid("{E763DB07-490F-4cb1-BEAA-330CCA715784}");
        public readonly static Guid Rapidshare = new Guid("{A80B5422-8E25-4078-9607-A6C7E014F99A}");
        public readonly static Guid Uploading = new Guid("{03051B43-EE64-481c-A3AA-EEF730C27E37}");

        #region Private Fields
        private readonly Guid id;
        private readonly string name;
        private readonly ProviderFlag flags;
        #endregion
        #region Constructors
        public ProviderInfo(Guid id, string name, ProviderFlag flags)
        {
            this.id = id;
            this.name = name;
            this.flags = flags;
        }
        #endregion

        #region Public Members
        public Guid Id
        {
            get { return this.id; }
        }

        public string Name
        {
            get { return this.name; }
        }

        public bool IsResumable()
        {
            return (this.flags & ProviderFlag.Resumable) == ProviderFlag.Resumable;
        }
        #endregion
        #region Overridden Members
        public override string ToString()
        {
            return this.name;
        }

        public override int GetHashCode()
        {
            return this.id.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            var second = obj as ProviderInfo;

            return second != null && second.id == this.id;
        }
        #endregion
    }
}
